/*
 * Created on 2006-3-27
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package com.jycrm.dao.login.impl;

import java.util.List;

import com.jycrm.dao.core.AbstractService;
import com.jycrm.dao.login.ILoginDao;
import com.jycrm.domain.user.CrmUser;

/**
 * @author Administrator
 * @date    2006-3-27
 * 
 */
public class LoginDaoImpl extends AbstractService implements ILoginDao {

    /* (non-Javadoc)
     * @see com.jycrm.dao.login.ILoginDao#authorizableUser(java.lang.String, java.lang.String)
     */
    public CrmUser authorizableUser(String loginName, String password) {
       
        Object[] objs = new Object[2];
        objs[0] = loginName;
        objs[1] = password;
        List list = queryManager.findByNamedQuery("getUserByNameAndPasswd",objs);
        if(list != null) {
            return list.size() == 1 ? (CrmUser)list.get(0) : null;
        } else {
            return null;
        }
    }
}
